package com.ruoyi.business.dbopt.vo;

import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
public class OptLog {
    private int opt;
    private String log;
    private String optFile;
    private String time;
    private long timeLong;

    public static OptLog backup(String logStr){
        OptLog log = new OptLog();
        log.time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        log.timeLong = System.currentTimeMillis();
        log.opt = 1;
        log.log = logStr;
        return log;
    }

    public static OptLog restore(String logStr){
        OptLog log = new OptLog();
        log.time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        log.opt = 2;
        log.log = logStr;
        return log;
    }

}
